import App from './App'
import Vue from 'vue'
import router from '_router'
import store from '_store'

// 引入自定义全局样式
import '_style/layout.scss'

// viewui
import './ui_library'

// 引入自定义工具插件
import utils from '_library/utils'

// 引入自定义过滤器
import filters from '_library/filters'

// 引入自定义指令
import directives from '_library/directives'

// 注册全局mixin
import mixin from '_library/mixins'

// 全局注册组件
import components from '_components'

// 注册工具
Vue.use(utils)

// 注册过滤器和自定义指令
Object.keys(filters).forEach(key => Vue.filter(key, filters[key]))
Object.keys(directives).forEach(key => Vue.directive(key, directives[key]))

// 注册全局混入
Vue.mixin(mixin)

// 注册全局组件
Object.keys(components).forEach(key => Vue.component(key, components[key]))

/* Vue 全局配置 */
Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App),
  mounted() {
    document.dispatchEvent(new Event('render-event'))
  },
}).$mount('#app')
